import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
from selenium.webdriver.support.select import Select
testCase="DBshop010_后台销售管理--处理退货订单流程"

firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'销售管理','退货管理')
firefox.find_element_by_link_text('处理退货').click()
firefox.find_element_by_id('refund_price').clear()
firefox.find_element_by_id('refund_price').send_keys('2199')
firefox.find_element_by_id('re_refund_info').send_keys('同意')
firefox.find_element_by_xpath('//button[text()="提交处理结果"]').click()
time.sleep(1)
firefox.quit()

firefox=openBrowser(url)
DBshopLogin(firefox,userName,password)

firefox.find_element_by_link_text("我的订单").click()
firefox.find_element_by_link_text('退货申请').click()

a=firefox.find_element_by_xpath('//table/tbody/tr/td[4]').text
if a == ('退款成功'):
    print('%s   测试通过'%testCase)
else:
    print('%s   测试失败'%testCase)

time.sleep(2)
firefox.quit()